package com.chinasofti.generic;

import java.util.ArrayList;

public class Generic03 {
    //定义一个泛型方法，传递一个集合和四个元素，将元素添加到集合中并返回；
    public static <T> ArrayList<T> addElement(ArrayList<T> list,T t1,T t2,T t3,T t4){
        list.add(t1);
        list.add(t2);
        list.add(t3);
        list.add(t4);
        return list;
    }

    public static void main(String[] args) {
        ArrayList<String> list = addElement(new ArrayList<String>(), "1", "b", "c", "d");
        System.out.println(list);
    }
}
